package com.lyh.service.impl;

import com.lyh.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.concurrent.ExecutorService;

@Service
public class TestServiceImpl implements TestService {

    @Autowired
    ExecutorService executorService;

    @Override
    @Async
    public void func() {
        try {
            Thread.sleep(3000);
            System.out.println("完成异步任务");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }
}
